package com.hadoop;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URI;

public class hdfsTest {

    static Configuration conf = new Configuration();
    static FileSystem fileSystem;

    public static void main(String [] args)throws Exception{
        upload();
//        download();
       //  xiazai();
    }

    public static void upload() throws Exception{

        fileSystem = FileSystem.get(conf);
        fileSystem.copyFromLocalFile(false,new Path("D:/hadoop/lkq.txt"),new Path("/"));
        fileSystem.close();
        System.out.println("上传完成");
    }
    public static void xiazai()throws Exception{
        fileSystem=FileSystem.get(conf);
        fileSystem.copyToLocalFile(false,new Path("/lkq.txt"),new Path("D:/hadoop/xiazai"),true);
        fileSystem.close();
        System.out.println("下载完成");
    }
}
